package com.cmict.data.bpm.framework.flowable.core.behavior.script.impl;

import com.cmict.data.bpm.dal.dataobject.definition.BpmTaskAssignRuleDO;
import com.cmict.data.bpm.enums.definition.BpmTaskRuleScriptEnum;
import org.flowable.engine.delegate.DelegateExecution;
import org.springframework.stereotype.Component;

import java.util.Collections;
import java.util.Map;
import java.util.Set;

/**
 * 使用表单变量中的用户作为流程审批人
 * @author liutao
 * @date 2022/11/8
 */
@Component
public class BpmTaskAssignVariableUserScript extends BpmTaskAssignVariableAbstractScript {

    /**
     * 用户变量直接作为审批人
     * @param executionMap 执行任务
     * @param rule  用户变量配置
     * @return
     */
    @Override
    public Set<Long> calculateTaskCandidateUsers(DelegateExecution execution, BpmTaskAssignRuleDO rule) {
        return calculateTaskCandidateUser(execution, rule);
    }

//    @Override
//    public Set<Long> calculateTaskCandidateUsers(Map<String, String> executionMap, BpmTaskAssignRuleDO rule) {
//        return calculateTaskCandidateUser(executionMap, rule);
//    }

    @Override
    public BpmTaskRuleScriptEnum getEnum() {
        return BpmTaskRuleScriptEnum.FORM_USER;
    }

}
